package cn.bgs.service.impl;



import cn.bgs.mapper.RepairMapper;
import cn.bgs.page.PageRequest;
import cn.bgs.pojo.Maintenances;
import cn.bgs.service.RepairService;
import cn.bgs.utils.R;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class RepairServiceImpl implements RepairService {
    @Autowired
    private RepairMapper repairMapper;


    @Override
    public R repairDelect(Integer maintenanceId) {
        int i = repairMapper.repairDelect(maintenanceId);
        return R.ok().data("i",i);
    }

    @Override
    public PageInfo<Maintenances> repairSelect(PageRequest pageRequest,String owner) {
        PageHelper.startPage(pageRequest.getPageNum(),pageRequest.getPageSize());
        PageInfo<Maintenances> userPageInfo = new PageInfo<>(repairMapper.selectAll(owner));
        return userPageInfo;
    }

    @Override
    public R repairAdd(Maintenances maintenances) {
        int i = repairMapper.repairAdd(maintenances);
        return R.ok().data("i",i);
    }

    @Override
    public R repairUpdate(Maintenances maintenances) {
        int i = repairMapper.repairUpdate(maintenances);
        return R.ok().data("i",i);
    }
}
